Skip to content

Conversation

@kl3ryk
Copy link
Contributor

@kl3ryk kl3ryk commented May 15, 2014

I tried to run example with sum under windows 7, but i have the following message:
Found 0 matching tests.

Problem exists because here: https://github.com/facebook/jest/blob/master/src/TestRunner.js#L122 regexp always return false.

Why? Because on windows directory separator is \ and on some other systems it is /, so some regexps (https://github.com/facebook/jest/blob/master/src/TestRunner.js#L78, https://github.com/facebook/jest/blob/master/bin/jest.js#L198) always gives false.

@kl3ryk kl3ryk mentioned this pull request May 15, 2014
@kl3ryk
Copy link
Contributor Author

kl3ryk commented May 15, 2014

I also have question - what are your prefferences for writing platofrm specific tests eg.: for windows:

  if(os.platform() == 'win32'){
      // some tests
  }

it is enough?

@ThomasDeutsch
Copy link

Now, matching tests are found. At least i get "Found 1 matching test..."

But still an error:

TypeError: Object #<Object> has no method 'find'
  at findNative (C:\dev\jesttest\node_modules\jest-cli\node_modules\node-haste\lib\FileFinder.js:91:17)

@kl3ryk
Copy link
Contributor Author

kl3ryk commented May 15, 2014

@ThomasDeutsch yes i know i reported this error here: facebookarchive/node-haste#12. I will push pull request later to fix this.

@kl3ryk
Copy link
Contributor Author

kl3ryk commented May 15, 2014

@ThomasDeutsch i have pushed PR with fix. Everything should work now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging in to this. My guess is there are probably a couple of other places in the code where we need to be better about staying platform-agnostic with regard to paths (better use of path.join and path.sep where appropriate)...but this is a good start.

Can we move this normalization into utils.normalizeConfig() so that anyone who reads the config object gets the benefit of using already-normalized data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I want to do this. I thinking about move normalization into new library because i saw there are same problem in others libs eg.: facebookarchive/node-haste#2.

@jeffmo
Copy link
Contributor

jeffmo commented May 16, 2014

The problem with writing platform-specific tests is that they won't fail if someone is developing on another platform and breaks something. It would be much better if the tests mocked out platform-specific APIs and used that to test instead

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@kl3ryk
Copy link
Contributor Author

kl3ryk commented May 19, 2014

@jeffmo fix is ready to merge. Tests are passing under windows an linux

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not all config strings are paths (and thus we shouldn't necessarily normalize them as if they were).
Was there a specific case you were trying to cover with this instead of the places you updated inside normalizeConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree but there is path.resolve used so it will be path after it. Also that line https://github.com/kl3ryk/jest/blob/master/src/lib/utils.js#L50 says that there is <rootDir> inside that string, so we can say this string is a path.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you're right -- this whole function should only be called on path strings anyway.
Nevermind my previous comments

@kl3ryk
Copy link
Contributor Author

kl3ryk commented May 31, 2014

@jeffmo fix is ready to merge.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you throw this suite into a separate file (say, utils-pathNormalize-test.js) so that it runs in parallel with the other tests?

@jeffmo
Copy link
Contributor

jeffmo commented Jun 1, 2014

I'm pretty happy with this now -- just want to address the two comments I just now mentioned and I think we're ready to merge

@jeffmo
Copy link
Contributor

jeffmo commented Jun 16, 2014

Heya @kl3ryk, thanks a ton for working through this with me. This is going to make a lot of win devs happy :)

I've been swamped the last couple of weeks so I haven't had a chance to follow up. If you can split out the 'utils-pathNormalize test into it's own file (out of the utils-normalizeConfig-test.js file), I'll go ahead and merge this.

@kl3ryk
Copy link
Contributor Author

kl3ryk commented Jun 16, 2014

Ahhh sorry i forgot about this :). Tomorrow I will fix all that stuff :)

jeffmo added a commit that referenced this pull request Jun 25, 2014
Windows: Found 0 matching tests
@jeffmo jeffmo merged commit 36e51ad into jestjs:master Jun 25, 2014
@kl3ryk
Copy link
Contributor Author

kl3ryk commented Jun 26, 2014

Sorry for the delay but I have a lot of work and will have time for that on weekend.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants